package com.cinc.ebc.sd.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cinc.ebc.mm.entity.MmPurchaseRequisition;
import com.cinc.ebc.sd.entity.SdDispatchLoadDetail;
import com.cinc.ebc.sd.mapper.SdDispatchLoadDetailMapper;
import com.cinc.ebc.sd.model.SdDispatchLoadDetailOutModel;
import com.cinc.ebc.sd.model.SdDispatchLoadDetailStockModel;
import com.cinc.ebc.sd.service.ISdDispatchLoadDetailService;
import com.cinc.ebc.sd.vo.SdDispatchLoadDetailPage;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: 装车明细
 * @Author: jeecg-boot
 * @Date:   2022-09-25
 * @Version: V1.0
 */
@Service
public class SdDispatchLoadDetailServiceImpl extends ServiceImpl<SdDispatchLoadDetailMapper, SdDispatchLoadDetail> implements ISdDispatchLoadDetailService {

	@Autowired
	private SdDispatchLoadDetailMapper sdDispatchLoadDetailMapper;

	@Override
	public List<SdDispatchLoadDetail> selectByMainId(String mainId) {
		return sdDispatchLoadDetailMapper.selectByMainId(mainId);
	}

	@Override
	public List<SdDispatchLoadDetailStockModel> selectStockByMainId(String mainId) {
		return sdDispatchLoadDetailMapper.selectStockByMainId(mainId);
	}

	/**
	 * 出库分页查询
	 * @param page
	 * @param detailPage
	 * @return
	 */
	@Override
	public IPage<SdDispatchLoadDetailOutModel> outPage(Page<SdDispatchLoadDetailOutModel> page, SdDispatchLoadDetailPage detailPage) {
		String sql = QueryGenerator.installAuthJdbc(MmPurchaseRequisition.class);
		return page.setRecords(sdDispatchLoadDetailMapper.selectOutList(page,detailPage,sql));
	}

	/**
	 * 装车明细查询
	 * @param detailPage
	 * @return
	 */
	@Override
	public List<SdDispatchLoadDetailOutModel> detailList(SdDispatchLoadDetailPage detailPage) {
		String sql = QueryGenerator.installAuthJdbc(MmPurchaseRequisition.class);
		return sdDispatchLoadDetailMapper.selectOutList(null, detailPage, sql);
	}
}
